import axios from "axios";

const http = axios.create({
  baseURL: "https://m.maizuo.com",
  timeout: 5000,
  headers: {
    "X-Client-Info":
      '{"a":"3000","ch":"1002","v":"5.0.4","e":"1596502176387264316178433","bc":"310100"}'
  }
});

// 请求拦截
http.interceptors.request.use(
  config => {
    // Toast.loading({
    //   message: '加载中...',
    //   forbidClick: true,
    // });
    return config;
  },
  err => {
    return Promise.reject(err);
  }
);

// 响应拦截
http.interceptors.response.use(
  res => {
    // Toast.clear();
    return res.data;
  },
  err => {
    return Promise.reject(err);
  }
);

export default http;
